<html>
<head><meta charset="utf-8"><title>A Range trate · t-cargo/PubGrub · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/index.html">t-cargo/PubGrub</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html">A Range trate</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="217646438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/217646438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#217646438">(Nov 23 2020 at 16:02)</a>:</h4>
<p>In <a href="https://github.com/mpizenberg/pubgrub-rs/issues/49">pubgrub#49</a> and <a href="https://github.com/pubgrub-rs/advanced_dependency_providers/issues/3">advanced_dependency_providers#3</a> we've been discussing making a Range trate in addition to the Range type that we use now. When should we give this a try? Clearly before <a href="https://github.com/mpizenberg/pubgrub-rs/issues/59">pubgrub#59</a> lands, that change needs to be compatible with a Range trate. Do you want to deal with a PR now or later in the week or after a perf focused <code>2.1</code> release or what are you thinking?</p>



<a name="217649256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/217649256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#217649256">(Nov 23 2020 at 16:21)</a>:</h4>
<p>I think getting this done needs to be done before talking to semver maintainers about how to proceed with integration. Can they add the apis we need, a big ask as semver is not getting much maintenance. Or do we fork. Or do we write our own. Or something else. But we need to know exactly what API's we need before we can start that discussion.</p>



<a name="217681489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/217681489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#217681489">(Nov 23 2020 at 20:53)</a>:</h4>
<p>Experimenting with range should happen before 59 yes, and it needs quite some work in my opinion. Both to design it and to prove it's actually useful by making examples that take advantage of it and would have been impossible or too cumbersome to implement without. I don't think there is a need for a perf focused release, we can just roll perf improvements into other releases.</p>



<a name="217681605"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/217681605" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#217681605">(Nov 23 2020 at 20:55)</a>:</h4>
<p>That being said, I'll mostly be in reader mode for a few weeks and not make much progress on my own so if you want to prioritize your work differently of course do as you prefer</p>



<a name="217681872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/217681872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#217681872">(Nov 23 2020 at 20:58)</a>:</h4>
<blockquote>
<p>a big ask as semver is not getting much maintenance</p>
</blockquote>
<p>Agreed, for the few things I've done last weekend I've forked the repo. We should take our time for this and make progress without asking for their attention as long as we can.</p>



<a name="217693080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/217693080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#217693080">(Nov 23 2020 at 22:42)</a>:</h4>
<blockquote>
<p>I'll mostly be in reader mode for a few weeks</p>
</blockquote>
<p>So I guess the question is what kind of PR's are landable while you work on other things. I don't want to pressure you to review something you don't have time for. But it would be nice to keep some momentum going. Perf, or this range trate, or other suggestions...</p>



<a name="217722274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/217722274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#217722274">(Nov 24 2020 at 07:48)</a>:</h4>
<p>The small vec and small map are definitely landable, I've already read most of it, mostly waiting on Alex approval. Other perf work might be tricky to review since it definitely requires more than reading (at least testing on my machine). I think the <code>Range</code> trait could occupy whoever works on it for quite some time so that's a good option too. Error reporting messages could also be worked on. Don't hesitate to steal things from there too if you feel like it: <a href="https://github.com/pubgrub-rs/advanced_dependency_providers/issues/5">https://github.com/pubgrub-rs/advanced_dependency_providers/issues/5</a>.</p>



<a name="217722495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/217722495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#217722495">(Nov 24 2020 at 07:52)</a>:</h4>
<p>I suppose porting some dart tests could be useful too <a href="https://github.com/pubgrub-rs/pubgrub/issues/30">https://github.com/pubgrub-rs/pubgrub/issues/30</a>. but don't know since I've not looked at them.</p>



<a name="217722752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/217722752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#217722752">(Nov 24 2020 at 07:57)</a>:</h4>
<p>Working on registry stats and resolver stats could be useful too. Determine if a given set of dependencies generates lots of conflicts or not.</p>



<a name="217722957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/217722957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#217722957">(Nov 24 2020 at 08:01)</a>:</h4>
<p>Study another package manager with a concrete use case analysis would be interesting too. Maybe current capabilities are enough to solve dependencies of all packages or a subset of npm or conda or another one.</p>



<a name="218108987"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/218108987" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#218108987">(Nov 27 2020 at 16:27)</a>:</h4>
<p>Work and the holiday and other things used up my time this week and so I have made very little progress, I do have a branch where I am working on a range trate, but still working to get it to compile. Just an update.</p>



<a name="218297155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/218297155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#218297155">(Nov 30 2020 at 14:57)</a>:</h4>
<p>It compiles now. So nets steps include cleaning up the trate and trying to use it for something.</p>



<a name="218993371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/218993371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> MrGreenTea <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#218993371">(Dec 06 2020 at 16:18)</a>:</h4>
<p>What's the current plan for a <code>Range</code> trait?<br>
To me it looks like it could solve a few problems, for example with pre-release versions.<br>
There also a few things I haven't found to be easy with the current <code>Range</code>, for example expressing strictly greater than.</p>
<p>I would love to take a crack at some ideas I have</p>



<a name="218993524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/218993524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> MrGreenTea <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#218993524">(Dec 06 2020 at 16:23)</a>:</h4>
<p>The only thing I am unsure about is if then <code>Range</code> can usably be indepent of <code>Version</code> or if I will end up implementing one <code>Range</code> for one <code>Version</code></p>



<a name="218993735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/218993735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> MrGreenTea <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#218993735">(Dec 06 2020 at 16:29)</a>:</h4>
<p>This should also remove the need for <code>Version::bump</code> I think</p>



<a name="218993812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/218993812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> MrGreenTea <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#218993812">(Dec 06 2020 at 16:31)</a>:</h4>
<p>And even <code>lowest</code> could be removed and with that is there even any need for the <code>Version</code> trait or wouldn't all needed logic be moved to the <code>Range</code>?</p>



<a name="218994487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/218994487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#218994487">(Dec 06 2020 at 16:50)</a>:</h4>
<p><span class="user-mention" data-user-id="367935">@MrGreenTea</span> you can have a look at the discussion started here: <a href="https://github.com/pubgrub-rs/pubgrub/issues/49">https://github.com/pubgrub-rs/pubgrub/issues/49</a><br>
There are possibly things not up to date with the work <span class="user-mention" data-user-id="120179">@Eh2406</span> started though (don't know myself)</p>



<a name="218994808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/218994808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#218994808">(Dec 06 2020 at 17:00)</a>:</h4>
<p>Indeed I also believe that there would be no more constraint related to Version, only to Range. The one perilous thing is that we let people implement their range intersection and equality that can be treacherous to implement right. It is highly important that ranges can be compared for equality in an efficient way, so canonical representations are ideal. Enabling open brackets on a lower bound and closed brackets on a higher bound are amongst the things that make equality check treacherous.</p>



<a name="218994953"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/218994953" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> MrGreenTea <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#218994953">(Dec 06 2020 at 17:04)</a>:</h4>
<p>I think so too, a useful default implentation should then probably be provided? I'll play around with a few ideas and come back to you</p>



<a name="218999981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/218999981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#218999981">(Dec 06 2020 at 19:17)</a>:</h4>
<p>Sorry for the delay. Some things came up and ate all of my available time. (<a href="https://github.com/rust-lang/cargo/pull/8890">https://github.com/rust-lang/cargo/pull/8890</a>, and something I can't talk about.)<br>
The range trait seems to work and to obviate the need for a version trait. I wanted to use if for something before I made a PR. I just pushed it <a href="https://github.com/pubgrub-rs/pubgrub/tree/range-trait">https://github.com/pubgrub-rs/pubgrub/tree/range-trait</a> if you want to give it a try. If it works for you then that is a good sine.<br>
One gotcha is that if a range can have no members then it should Eq it's <code>none</code> repozentation.</p>



<a name="219000054"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/219000054" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#219000054">(Dec 06 2020 at 19:19)</a>:</h4>
<p>All the names and documentation need to be updated. But it is good enough to figure out if it is good for anything.</p>



<a name="219000055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/219000055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#219000055">(Dec 06 2020 at 19:19)</a>:</h4>
<blockquote>
<p>There also a few things I haven't found to be easy with the current Range, for example expressing strictly greater than.</p>
</blockquote>
<p>We should just add constructors for that to the existing Range.</p>



<a name="219004002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/219004002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#219004002">(Dec 06 2020 at 19:50)</a>:</h4>
<blockquote>
<p><a href="https://github.com/rust-lang/cargo/pull/8890">https://github.com/rust-lang/cargo/pull/8890</a></p>
</blockquote>
<p>That looks like a huge amount of work!</p>



<a name="219078242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/219078242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> MrGreenTea <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#219078242">(Dec 07 2020 at 13:20)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120179">Eh2406</span> <a href="#narrow/stream/260232-t-cargo.2FPubGrub/topic/A.20Range.20trate/near/218999981">said</a>:</p>
<blockquote>
<p>Sorry for the delay. Some things came up and ate all of my available time. (<a href="https://github.com/rust-lang/cargo/pull/8890">https://github.com/rust-lang/cargo/pull/8890</a>, and something I can't talk about.)<br>
The range trait seems to work and to obviate the need for a version trait. I wanted to use if for something before I made a PR. I just pushed it <a href="https://github.com/pubgrub-rs/pubgrub/tree/range-trait">https://github.com/pubgrub-rs/pubgrub/tree/range-trait</a> if you want to give it a try. If it works for you then that is a good sine.<br>
One gotcha is that if a range can have no members then it should Eq it's <code>none</code> repozentation.</p>
</blockquote>
<p>Why not have <code>Range::is_empty</code> ?</p>



<a name="219079981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/219079981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> MrGreenTea <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#219079981">(Dec 07 2020 at 13:36)</a>:</h4>
<p>Is <code>Range::negate</code> really needed? I can't see it's usage besides in <code>Range::union</code>.</p>



<a name="219081068"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/219081068" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#219081068">(Dec 07 2020 at 13:46)</a>:</h4>
<p>Yes it's needed for Range::union, itself needed for the intersection of two negative terms</p>



<a name="219083196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/219083196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#219083196">(Dec 07 2020 at 14:05)</a>:</h4>
<p>by the way, regarding names, <code>complement</code> and <code>singleton</code> and <code>empty</code> would be better fits than <code>negate</code>,  <code>exact</code> and <code>none</code>  if we are to make a range trait</p>



<a name="219087288"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/219087288" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#219087288">(Dec 07 2020 at 14:39)</a>:</h4>
<p>Making sure all the methods are needed, considering if all the traits are needed (yes, removing Eq and adding <code>is_empty</code> makes sense), and renaming things, was on my todo list for after demonstrating that it could be used for something.</p>



<a name="219111876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/219111876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#219111876">(Dec 07 2020 at 17:39)</a>:</h4>
<blockquote>
<p>Range::is_empty</p>
</blockquote>
<p>unfortunately, we also use <code>self.intersection(other) == other</code>. So switching away from <code>Eq</code> is not in scope for a first PR. If <a href="https://github.com/mpizenberg/pubgrub-rs/issues/59">pubgrub#59</a> is merged, then it may be possible to remove the <code>Eq</code> bound then.</p>



<a name="219113177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/219113177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#219113177">(Dec 07 2020 at 17:49)</a>:</h4>
<blockquote>
<p>Range::negate</p>
</blockquote>
<p>The only use is in <code>Term::intersection</code> where it is used as <code>r1.intersection(&amp;r2.negate())</code> we could make that one method call with something like <code>r1.subtract(&amp;r2)</code> if that would be easier to implement.</p>



<a name="219258207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/219258207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> MrGreenTea <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#219258207">(Dec 08 2020 at 20:28)</a>:</h4>
<p>(deleted)</p>



<a name="219258257"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/219258257" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#219258257">(Dec 08 2020 at 20:28)</a>:</h4>
<p>No it is also used for <code>Term::intersection</code></p>



<a name="219258280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/219258280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> MrGreenTea <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#219258280">(Dec 08 2020 at 20:29)</a>:</h4>
<p>Yeah I just noticed that, sorry!</p>



<a name="219258396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/219258396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> MrGreenTea <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#219258396">(Dec 08 2020 at 20:30)</a>:</h4>
<p>Thanks for the information, I'm mostly just trying to understand it and the design :)</p>



<a name="219258907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/219258907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#219258907">(Dec 08 2020 at 20:34)</a>:</h4>
<p>For understanding the code I'd suggest the following steps:</p>
<ul>
<li>read intro blog post to pubgrub <a href="https://medium.com/@nex3/pubgrub-2fb6470504f">https://medium.com/@nex3/pubgrub-2fb6470504f</a></li>
<li>read the solver doc, without necessarily go into algorithm details <a href="https://github.com/dart-lang/pub/blob/master/doc/solver.md">https://github.com/dart-lang/pub/blob/master/doc/solver.md</a></li>
<li>read our guide <a href="https://pubgrub-rs-guide.netlify.app/">https://pubgrub-rs-guide.netlify.app/</a></li>
</ul>
<p>It might take you some time but will definitely improve understanding I think</p>



<a name="219259998"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/219259998" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#219259998">(Dec 08 2020 at 20:43)</a>:</h4>
<p>Those are all great resources, but I am happy to answer questions (even without the background) if that is your preferred learning style.</p>



<a name="219348510"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/219348510" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#219348510">(Dec 09 2020 at 15:08)</a>:</h4>
<p>BTW a new memory profiler for rust was just released. Someone should try it to see if it points to good perf opportunities.</p>



<a name="219364470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/219364470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#219364470">(Dec 09 2020 at 16:52)</a>:</h4>
<p>Successfully ran it on <code>large_case_u16_NumberVersion</code> with the smallmap and smallvec.<br>
The report lets you sort many different things:</p>
<ul>
<li>by number of allocations, it is dominated by short lived allocation inlined into <code>unit_propagation</code>. Don't know what to make of this.</li>
<li>by number of bytes, it is dominated by <code>PartialSolution::from_assignments</code> in <code>backtrack</code>. We can optimize this, we don't need to be rebuilding everything.</li>
<li>by allocation at max mem usage, it is dominated by <code>Rc::make_mut</code> in <code>backtrack</code>. There have to be better ways to do this, the interning idea, or a better structure then one big <code>RC</code>.</li>
</ul>



<a name="219390659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/219390659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#219390659">(Dec 09 2020 at 20:06)</a>:</h4>
<p>Trying this (for cargo) just got easier: <a href="https://github.com/steveklabnik/semver/pull/223">https://github.com/steveklabnik/semver/pull/223</a></p>



<a name="220806642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/220806642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#220806642">(Dec 23 2020 at 17:03)</a>:</h4>
<p>When we get this project moving again and we get the perf work merged. I want to massively increase the size of the end-to-end proptests. And I want to set up a separate build that runs those tests in a loop to see if we find anything interesting by running on my desktop for a few days.</p>



<a name="221522241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/221522241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#221522241">(Jan 04 2021 at 13:23)</a>:</h4>
<p>Personally, I'll have few busy weeks until end of january. I'll try have a look again at the perf PR next weekend. Except if <span class="user-mention" data-user-id="340766">@Alex Tokarev</span> objects I think we can merge it then.</p>



<a name="221528704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/221528704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#221528704">(Jan 04 2021 at 14:27)</a>:</h4>
<p>Sounds like a plan. I recall having several more PRs of perf work, hopefully I can remember what they where when we get started agen.</p>



<a name="236987103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/236987103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#236987103">(May 01 2021 at 17:57)</a>:</h4>
<p>Seems like another person again needs pre-release. We are starting a streak ahah, 2 days in a row</p>



<a name="236989076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/236989076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#236989076">(May 01 2021 at 18:27)</a>:</h4>
<p>I love that people are using pubgrub.</p>



<a name="237001460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/237001460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#237001460">(May 01 2021 at 21:19)</a>:</h4>
<blockquote>
<p>I love that people are using pubgrub.</p>
</blockquote>
<p>Or trying at least XD</p>



<a name="237001842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/237001842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#237001842">(May 01 2021 at 21:21)</a>:</h4>
<p>I sat down to work on rebasing the Range trait, but found another (small) perf win. So oops, and PR incoming.</p>



<a name="237014113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/237014113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#237014113">(May 02 2021 at 00:51)</a>:</h4>
<p>I just rebased and force pushed the range trate branch.</p>



<a name="243307408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/243307408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#243307408">(Jun 20 2021 at 15:20)</a>:</h4>
<p>By the way, few weeks ago I had a look at this fork <a href="https://github.com/PhotonQuantum/pubgrub/tree/release">https://github.com/PhotonQuantum/pubgrub/tree/release</a><br>
They didn't interact with us verbally but maybe what they did is useful? There are 3 commits where they switched our <code>Range</code> impl by the one of the <code>ranges</code> crate: <a href="https://crates.io/crates/ranges">https://crates.io/crates/ranges</a></p>
<p>The commit says "feat: support continuous and infinite domain". Maybe it's useful? I can see from briefly looking at the commit changes that there is a notion of closed segment on both sides since they do not need the <code>bump</code> method to define <code>Range::exact</code>.</p>
<p>Just thought I would bring this to you in case it can help for your ongoing experiments.</p>



<a name="243307600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/243307600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#243307600">(Jun 20 2021 at 15:25)</a>:</h4>
<blockquote>
<p>I am getting distracted by a new plan to impl the RangeTrait for Cargos Semver. I think this may work.</p>
</blockquote>
<p>It work in that for all <code>VersionReq</code> on <a href="http://crates.io">crates.io</a> for all <code>Version</code> on <a href="http://crates.io">crates.io</a> my <code>MyRange.contanes(ver) == Semver.matchs(ver)</code>, and  <code>MyRange.negate().contanes(ver) == !Semver.matchs(ver)</code> (including pre releases vers)!<br>
I am still testing if <code>MyRange1.intersection(MyRange2).contanes(ver) == (Semver1.matchs(ver) &amp;&amp; Semver2.matchs(ver))</code>. My little lap top will have checked them all in ~3h more.</p>



<a name="243307967"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/243307967" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#243307967">(Jun 20 2021 at 15:34)</a>:</h4>
<p>I had not hared of the <code>ranges</code> crate. We should look into it. If it is "better" we should us it for our <code>Range</code> for v3, if it is not better then we should use it as an example of how the <code>RangeSet</code> can let you pick your representation of <code>Range</code> in v3. I will try to remember to be in touch with them!</p>



<a name="243320131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/243320131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#243320131">(Jun 20 2021 at 20:30)</a>:</h4>
<p>I was reading Python PEP 440 today and oh boy that's quite the mess! That's what it feels writing spec that try to be compatible with the wide variety of already existing practices. They not only have pre-releases, they also have dev realease, post-release, local release and epochs. You could end up with a version looking like this: <code>42!2021.06rc5.post9.dev3</code></p>



<a name="243320257"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/243320257" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#243320257">(Jun 20 2021 at 20:34)</a>:</h4>
<p>And then, when specifying version ranges, exclusive ordered comparisons (<code>&gt;</code> and <code>&lt;</code>) specifically exclude pre-releases (and dev releases) and post-releases <strong>of the specified version</strong> (not of the earlier or later releases). And pre-releases and dev releases are implicitly excluded from all versions specifiers, unless already present on the local system, explicitly required by the user, or the only available version satisfying a given specifier.</p>



<a name="243325297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/243325297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#243325297">(Jun 20 2021 at 22:40)</a>:</h4>
<p>Cargo only has Pre releases, but still has different semantics for what can get matched by them. It was pretty tricky to  get everything to get the same answer., but I am happy to report  that I have done it! The test for intersection just came back, and it got the same ancere for all pairs of <code>VersionReq</code> and <code>Version</code> on  <a href="http://crates.io">crates.io</a>.</p>



<a name="243325594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/243325594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#243325594">(Jun 20 2021 at 22:48)</a>:</h4>
<p>For Cargo <code>&gt;=1.2.3</code> can not match any versions with a pre release. So <code>"&gt;=1.2.3".negate()</code> would have to be <code>"&lt;1.2.3" or (is any pre release)</code>.</p>



<a name="243325718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/243325718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#243325718">(Jun 20 2021 at 22:52)</a>:</h4>
<p><code>&gt;=1.2.3-alfa</code> can  match pre releases that also start <code>1.2.3</code>. So it is more like <code>&gt;=1.2.3 or (is pre release &gt;=1.2.3-alfa and &lt;1.2.4)</code></p>



<a name="243325878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/243325878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#243325878">(Jun 20 2021 at 22:56)</a>:</h4>
<p>The most extreme case is <code>*</code> witch matches any non pre release version. <code>"*".negate()</code> matches any pre release version, but no stable versions. That is going to be hard to represent in one number line.</p>



<a name="243325885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/243325885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#243325885">(Jun 20 2021 at 22:56)</a>:</h4>
<p>On friday I was thinking about how to represent theas, and thought that the ranges for normal releases and for pre releases seam totally independent.</p>



<a name="243325956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/243325956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#243325956">(Jun 20 2021 at 22:59)</a>:</h4>
<p>This leads to:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">struct</span> <span class="nc">SemverPubgrub</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">norml</span>: <span class="nc">Range</span><span class="o">&lt;</span><span class="n">Version</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">pre</span>: <span class="nc">Range</span><span class="o">&lt;</span><span class="n">Version</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">contains</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">version</span>: <span class="kp">&amp;</span><span class="nc">Version</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="kt">bool</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">if</span><span class="w"> </span><span class="n">version</span><span class="p">.</span><span class="n">pre</span><span class="p">.</span><span class="n">is_empty</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="bp">self</span><span class="p">.</span><span class="n">norml</span><span class="p">.</span><span class="n">contains</span><span class="p">(</span><span class="n">version</span><span class="p">)</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="bp">self</span><span class="p">.</span><span class="n">pre</span><span class="p">.</span><span class="n">contains</span><span class="p">(</span><span class="n">version</span><span class="p">)</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="243326011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/243326011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#243326011">(Jun 20 2021 at 23:00)</a>:</h4>
<p><code>intersection</code>, <code>negate</code>, <code>any</code>, and <code>none</code> can be done by doing the same thing to both parts.</p>



<a name="243326066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/243326066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#243326066">(Jun 20 2021 at 23:02)</a>:</h4>
<p>The hard (344 loc) part was converting the Semver syntax into ranges. But It worked!</p>



<a name="243329211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/243329211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#243329211">(Jun 21 2021 at 00:29)</a>:</h4>
<p>and here is the code: <a href="https://gist.github.com/Eh2406/88b8c799be3f3a6589073e8e58504a11">https://gist.github.com/Eh2406/88b8c799be3f3a6589073e8e58504a11</a></p>



<a name="243421822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260232-t-cargo/PubGrub/topic/A%20Range%20trate/near/243421822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthieu Pizenberg <a href="https://rust-lang.github.io/zulip_archive/stream/260232-t-cargo/PubGrub/topic/A.20Range.20trate.html#243421822">(Jun 21 2021 at 18:15)</a>:</h4>
<p>Nice! I've been reading a bit the <code>ranges</code> crate API and taking some inspiration to have a try and an improved API for us around all this. I think I'll try something looking like this and see where that goes:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">use</span><span class="w"> </span><span class="n">std</span>::<span class="n">ops</span>::<span class="p">{</span><span class="n">Bound</span><span class="p">,</span><span class="w"> </span><span class="n">RangeBounds</span><span class="p">};</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">trait</span><span class="w"> </span><span class="n">Version</span>: <span class="nb">Clone</span> <span class="o">+</span><span class="w"> </span><span class="nb">Ord</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">Debug</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">Display</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">minimum</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="nc">Bound</span><span class="o">&lt;</span><span class="bp">Self</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">maximum</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="nc">Bound</span><span class="o">&lt;</span><span class="bp">Self</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">struct</span> <span class="nc">Ranges</span><span class="o">&lt;</span><span class="n">I</span><span class="p">,</span><span class="w"> </span><span class="n">V</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">segments</span>: <span class="nc">SmallVec</span><span class="o">&lt;</span><span class="n">I</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">phantom</span>: <span class="nc">PhantomData</span><span class="o">&lt;</span><span class="n">V</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">trait</span><span class="w"> </span><span class="n">Interval</span><span class="o">&lt;</span><span class="n">V</span><span class="o">&gt;</span>: <span class="nc">RangeBounds</span><span class="o">&lt;</span><span class="n">V</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">new</span><span class="p">(</span><span class="n">start_bound</span>: <span class="nc">Bound</span><span class="o">&lt;</span><span class="n">V</span><span class="o">&gt;</span><span class="p">,</span><span class="w"> </span><span class="n">end_bound</span>: <span class="nc">Bound</span><span class="o">&lt;</span><span class="n">V</span><span class="o">&gt;</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>